<HTML><HEAD><TITLE>pathname(+FilePath, -Path, -BaseName, -Suffix)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Operating System</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>pathname(+FilePath, -Path, -BaseName, -Suffix)</H1>
Decomposes a filename into its directory path, base name and suffix
<DL>
<DT><EM>FilePath</EM></DT>
<DD>String or atom.
</DD>
<DT><EM>Path</EM></DT>
<DD>Variable or string.
</DD>
<DT><EM>BaseName</EM></DT>
<DD>Variable or string.
</DD>
<DT><EM>Suffix</EM></DT>
<DD>Variable or string.
</DD>
</DL>
<H2>Description</H2>
   This predicate is used to decompose FilePath which is either a relative
   or absolute pathname of a file, into three components, namely the pathname
   of its parent directory including the trailing "/" if any, the `base'
   name of the file (the plain file name without the suffix), and the
   suffix, if any. The concatenation of Path, BaseName and Suffix yields
   the original filename FilePath.

<H3>Modes and Determinism</H3><UL>
<LI>pathname(+, -, -, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>FilePath is not instantiated.
<DT><EM>(5) type error </EM>
<DD>FilePath is neither a string nor an atom.
<DT><EM>(5) type error </EM>
<DD>Path, BaseName or Suffix is neither a string nor a variable.
</DL>
<H2>Examples</H2>
<PRE>
Success:

     [eclipse]: pathname("/home/user/userfile.pl", P, B, S).

     P = "/home/user/"
     B = "userfile"
     S = ".pl"
     yes.

      [eclipse]: pathname("/home/user/userfile", P, B, S).
      P = "/home/user/"
      B = "userfile"
      S = ""
      yes.

Fail:
      pathname("/home/file.pl","/home/","file", "pl").

Error:
      pathname(F,P,R,S).                 (Error 4).
      pathname("/home/file.pl",P,file,'.pl')    (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/opsys/pathname-3.html">pathname / 3</A>, <A HREF="../../kernel/stratom/split_string-4.html">split_string / 4</A>, <A HREF="../../kernel/stratom/join_string-3.html">join_string / 3</A>, <A HREF="../../kernel/opsys/canonical_path_name-2.html">canonical_path_name / 2</A>
</BODY></HTML>
